<?php $this->load->view('public/product_pubnav'); ?>
    <section id="wrapper">
        <div id="container">

            <div class="nobox block description">
                <a href="#"><img src="http://i.meilishuo.net/css/images/pretty/pre_1.gif"></a>

                <div class="clr1"></div>
                <a href="#"><img src="http://i.meilishuo.net/css/images/pretty/pre_2.gif"></a>

                <div class="clr1"></div>
                <a href="#"><img src="http://i.meilishuo.net/css/images/pretty/pre_1.gif"></a>

                <div class="clr1"></div>
                <a href="#"><img src="http://i.meilishuo.net/css/images/pretty/pre_1.gif"></a>

            </div>
                <?php
                    if (!empty($baby)) {
                        foreach ($baby as $bk => $bv) {
                            $liker = $this->like_baby->get_list(array('baby_id'=>$bv['id']),'','','addtime desc');
                            $comments = $this->comment->get_list(array('baby_id'=>$bv['id']),'','','addtime desc');
                            $one_liker = !empty($liker) ? $this->member->get_one_list($liker[0]['liker_id']) : array();

                ?>
                    <div class="nobox block description">
                        <a href="<?php echo front_url('index/baby_detail').'/'.$bv['id'];?>" target="_blank"><img src="<?php echo base_url() . 'upload/baby/' . $bv['big_img']; ?>"></a>
                        
                        <div class="likes">
                            <p class="p1">
                            <?php if(!empty($this->member_id)){?>
                                <img class="like_baby" baby_id="<?php echo $bv['id'];?>" src="<?php echo base_url(); ?>images/column/like.jpg" width="50" height="20px" >&nbsp;&nbsp;
                            <?php }else{?>
                            	<img  onclick="openlogin()" baby_id="<?php echo $bv['id'];?>" src="<?php echo base_url(); ?>images/column/like.jpg" width="50" height="20px" >&nbsp;&nbsp;
                            <?php }?>
                                <font class="show_like_success"></font>
                                <font class="show_like_num"><?php echo count($liker);?></font>
                            </p>

                            <p class="p5">
                                <font color="#FF3399">
                                    <a href="javascript:viod(0)">评论</a> <?php echo count($comments);?>
                                </font>
                            </p>
                        </div>
                        
                        <p class="p2"><font
                                color="#666666"><a href="<?php echo front_url('index/baby_detail').'/'.$bv['id'];?>" target="_blank"><?php if (!empty($bv['desc'])) echo $bv['desc']; ?></a></font></p>
						<?php if(!empty($one_liker['id'])){    //如果有喜欢者，则显示最近一个喜欢人信息?>
                        <div class="uname1">
                        
                            <p class="p3">
                            
                            <a href="<?php echo base_url('column/center').'/'.$one_liker['id'];?>">
                            <img style="width:40px;height:40px;" src="<?php if(!empty($one_liker['img'])) {echo base_url().'upload/avator/'.$one_liker['img'];}else{echo 'http://assets.taobaocdn.com/app/sns/img/default/avatar-60.png';}?>"/>
                            </a>
                            </p>
                            
                            <p class="p4" style="width:auto"><a href="<?php echo base_url('column/center').'/'.$one_liker['id'];?>"><font style="padding-left:30px"><?php if(!empty($one_liker['name'])) {echo $one_liker['name'];?></font></a> <font color="#666666">喜欢了！</font><?php }?></p>
                        </div>
                        <?php }?>
                    </div>
                <?php }} ?>
        </div>
    </section>
<script type="text/javascript">
    $(document).ready(function(){
        $('.like_baby').click(function(){
            $baby_id = $(this).attr('baby_id');
            thats = $(this);
            $.ajax({
                type:"POST",
                url:"<?php echo base_url().'column/like_baby'?>",
                dataType:"json",
                data:{"baby_id":$baby_id},
                success:function(data){
                    thats.parents('.p1').find('.show_like_success').html(data.error);
                    thats.siblings('.show_like_num').html(data.like_num);
                }
            })
        })
    })

</script>
<?php $this->load->view('public/product_pubfooter'); ?>